#if defined(WITH_UNITTEST)
#include "base/memory/ref_count.h"
#include "gtest/gtest.h"
TEST(RefCount,Count)
{
	ebase::RefCount *ref = new ebase::RefCount();
	EXPECT_EQ(0, ref->ref());

	ref->AddRef();
	EXPECT_EQ(1, ref->ref());
	ref->AddRef();
	EXPECT_EQ(2, ref->ref());
	ref->AddRef();
	EXPECT_EQ(3, ref->ref());
	ref->Release();
	EXPECT_EQ(2, ref->ref());
	ref->Release();
	EXPECT_EQ(1, ref->ref());
	ref->Release();
}

#endif